#include <S32FILE.H>
#include <sysutil.h>
#include "HWRMLight.h"
#include "Settings.h"
#include "Utils.h"
#include "Uids.h"
#include "Logger.h"
#include "PathInfo.h"

TMyIntArray::TMyIntArray()
:iCount(0)
{
}

TInt TMyIntArray::Count() const
{
	return iCount;
}

TInt TMyIntArray::Find(TInt aItem) const
{
	for (TInt i = 0;i < iCount;i++)
	{
		if (iData[i] == aItem)
			return i;
	}
	return KErrNotFound;
}

void TMyIntArray::Append(TInt aItem)
{
	if (iCount == 29)
		return ;
	iData[iCount++] = aItem;
}

void TMyIntArray::LoadArrayL(CDictionaryStore* aIniFile, TInt aSettingId)
{
	TUid uid = TUid::Uid(aSettingId);
	if (aIniFile->IsPresentL(uid))
	{
		RDictionaryReadStream stream;
		stream.OpenLC(*aIniFile, uid);//+stream

		iCount = stream.ReadInt16L();
		for (TInt i = 0;i < iCount;i++)
		{
			iData[i] = stream.ReadUint32L();
		}

		CleanupStack::PopAndDestroy();//-stream
	}
	else
	{//reset the array
		iCount = 0;		
	}
}
